﻿using System;
using Microsoft.EntityFrameworkCore.Migrations;

namespace MimallAPI.Migrations
{
    public partial class qqqwe : Migration
    {
        protected override void Up(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.AddColumn<int>(
                name: "AddIndentAid",
                table: "Indents",
                type: "int",
                nullable: true);

            migrationBuilder.CreateTable(
                name: "addIndent",
                columns: table => new
                {
                    Aid = table.Column<int>(type: "int", nullable: false)
                        .Annotation("SqlServer:Identity", "1, 1"),
                    IndentId = table.Column<int>(type: "int", nullable: false),
                    IndentNumber = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    IndentGooder = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    IndentSum = table.Column<decimal>(type: "decimal(18,2)", nullable: false),
                    ReceId = table.Column<int>(type: "int", nullable: false),
                    UserId = table.Column<int>(type: "int", nullable: false),
                    CreateTime = table.Column<DateTime>(type: "datetime2", nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_addIndent", x => x.Aid);
                });

            migrationBuilder.CreateIndex(
                name: "IX_Indents_AddIndentAid",
                table: "Indents",
                column: "AddIndentAid");

            migrationBuilder.AddForeignKey(
                name: "FK_Indents_addIndent_AddIndentAid",
                table: "Indents",
                column: "AddIndentAid",
                principalTable: "addIndent",
                principalColumn: "Aid",
                onDelete: ReferentialAction.Restrict);
        }

        protected override void Down(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.DropForeignKey(
                name: "FK_Indents_addIndent_AddIndentAid",
                table: "Indents");

            migrationBuilder.DropTable(
                name: "addIndent");

            migrationBuilder.DropIndex(
                name: "IX_Indents_AddIndentAid",
                table: "Indents");

            migrationBuilder.DropColumn(
                name: "AddIndentAid",
                table: "Indents");
        }
    }
}
